import type { RouteMeta, RouteRecordRaw } from 'vue-router'

export function buildMeta(data: RouteMeta = {}): RouteMeta {
  return {
    ...data,
    module: 'COULD_COMPUTING',
  }
}
export default {
  path: '/could-computing',
  meta: buildMeta(),
  component: () => import('@/components/layout/DefaultLayout.vue'),
  children: [
    {
      path: 'group',
      meta: buildMeta({ title: '分组管理' }),
      children: [
        {
          path: 'cloud-computing',
          name: 'CouldComputingCloudComputingGroup',
          component: () =>
            import('@/views/cloud-computing/group/cloud-computing'),
          meta: buildMeta({ title: '云服务器分组' }),
        },
        {
          path: 'dedicated',
          name: 'CouldComputingDedicatedGroup',
          component: () => import('@/views/cloud-computing/group/dedicated'),
          meta: buildMeta({ title: '裸金属分组' }),
        },
      ],
    },
    {
      path: 'resource',
      meta: buildMeta({ title: '资源管理' }),
      children: [
        {
          path: 'region',
          name: 'CouldComputingRegions',
          component: () => import('@/views/cloud-computing/resource/regions'),
          meta: buildMeta({ title: '区域管理' }),
        },
        {
          path: 'switch',
          name: 'CouldComputingSwitch',
          component: () => import('@/views/cloud-computing/resource/switch'),
          meta: buildMeta({ title: '交换机管理' }),
        },
        {
          path: 'compute-node',
          name: 'CouldComputingComputeNode',
          component: () =>
            import('@/views/cloud-computing/resource/compute-node'),
          meta: buildMeta({ title: '计算节点' }),
        },
        {
          path: 'dedicated-node',
          name: 'CouldComputingDedicatedNode',
          component: () =>
            import('@/views/cloud-computing/resource/dedicated-node'),
          meta: buildMeta({ title: '裸金属节点' }),
        },
        {
          path: 'image',
          name: 'CouldComputingImages',
          component: () => import('@/views/cloud-computing/resource/images'),
          meta: buildMeta({ title: '镜像管理' }),
        },
        {
          path: 'bandwidth',
          name: 'CouldComputingBandwidth',
          component: () => import('@/views/cloud-computing/resource/bandwidth'),
          meta: buildMeta({ title: '带宽管理' }),
        },
        {
          path: 'ip',
          name: 'CouldComputingIP',
          component: () => import('@/views/cloud-computing/resource/ip'),
          meta: buildMeta({ title: 'IP 管理' }),
        },
      ],
    },
  ],
} satisfies RouteRecordRaw
